/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.diego.games.tetris.visual;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import java.io.IOException;

/**
 * @author diego
 */
public class GameDesign {

    //<editor-fold defaultstate="collapsed" desc=" Generated Fields ">//GEN-BEGIN:|fields|0|
    private Image block;
    private TiledLayer Tetris;
    private TiledLayer blocks;
    //</editor-fold>//GEN-END:|fields|0|

    //<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//GEN-BEGIN:|methods|0|
    //</editor-fold>//GEN-END:|methods|0|



    public Image getBlock() throws java.io.IOException {//GEN-BEGIN:|2-getter|0|2-preInit
        if (block == null) {//GEN-END:|2-getter|0|2-preInit
            // write pre-init user code here
            block = Image.createImage("/block.png");//GEN-BEGIN:|2-getter|1|2-postInit
        }//GEN-END:|2-getter|1|2-postInit
        // write post-init user code here
        return this.block;//GEN-BEGIN:|2-getter|2|
    }
//GEN-END:|2-getter|2|



    public TiledLayer getTetris() throws java.io.IOException {//GEN-BEGIN:|5-getter|0|5-preInit
        if (Tetris == null) {//GEN-END:|5-getter|0|5-preInit
            // write pre-init user code here
            Tetris = new TiledLayer(10, 20, getBlock(), 16, 16);//GEN-BEGIN:|5-getter|1|5-midInit
            int[][] tiles = {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };//GEN-END:|5-getter|1|5-midInit
            // write mid-init user code here
            for (int row = 0; row < 20; row++) {//GEN-BEGIN:|5-getter|2|5-postInit
                for (int col = 0; col < 10; col++) {
                    Tetris.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|5-getter|2|5-postInit
        // write post-init user code here
        return Tetris;//GEN-BEGIN:|5-getter|3|
    }
//GEN-END:|5-getter|3|

    public TiledLayer getBlocks() throws java.io.IOException {//GEN-BEGIN:|29-getter|0|29-preInit
        if (blocks == null) {//GEN-END:|29-getter|0|29-preInit
            // write pre-init user code here
            blocks = new TiledLayer(2, 3, getBlock(), 16, 16);//GEN-BEGIN:|29-getter|1|29-midInit
            int[][] tiles = {
                { 2, 0 },
                { 2, 2 },
                { 0, 2 }
            };//GEN-END:|29-getter|1|29-midInit
            // write mid-init user code here
            for (int row = 0; row < 3; row++) {//GEN-BEGIN:|29-getter|2|29-postInit
                for (int col = 0; col < 2; col++) {
                    blocks.setCell(col, row, tiles[row][col]);
                }
            }
        }//GEN-END:|29-getter|2|29-postInit
        // write post-init user code here
        return blocks;//GEN-BEGIN:|29-getter|3|
    }
//GEN-END:|29-getter|3|







}
